package rsj.service.stat;

import com.alibaba.fastjson.JSON;
import com.rlyy.aibase.utils.base.TableNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rsj.api.contract.entity.ContractStatistic;
import rsj.sql.stat.StatDao;

import java.util.List;

/**
 * 统计
 *
 * @author yuanqinglong
 * @since 2021/8/4 15:41
 */
@Service
public class StatServiceImpl implements IStatService {


    @Autowired
    private StatDao statDao;


    /**
     * 统计合同使用
     *
     * @param orgpId orgp id
     * @return {@link List<ContractStatistic>}
     */
    @Override
    public List<ContractStatistic> statisticContractUsage(List<String> orgpId) {
        TableNode tableNode = statDao.statisticContractUsage(orgpId);
        return JSON.parseArray(tableNode.toJson(), ContractStatistic.class);
    }
}
